Repository navigation
config: migrate velocity.toml to velocity.yaml (Configurate) - #1824
Draft
electronicboy wants to merge 8 commits into
Draft
electronicboy wants to merge 8 commits into
electronicboy wants to merge 8 commits into
Conversation
1:1 YAML port of default-velocity.toml with all documentation comments preserved verbatim. config-version becomes an integer (baseline 1) for Configurate's versioned transformation system; the `try` list nests under `servers` to mirror the legacy [servers] table. Part of the velocity.toml -> velocity.yml Configurate migration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tMapper Wire up the Configurate ObjectMapper path for the new velocity.yml format: - Make VelocityConfiguration ObjectMapper-friendly: no-arg constructor, non-final nested fields, transient on non-config fields (forwardingSecret, motdAsComponent, favicon), and drop the dead gson @expose annotations. - Annotate Advanced/Query/Metrics @ConfigSerializable and add @setting for the keys the lower-case-dashed naming scheme can't derive (kick-existing-players, packet-limiter, haproxy-protocol, accepts-transfers, query enabled/port/map). - Add ConfigurationLoader with a LOWER_CASE_DASHED ObjectMapper factory, a YAML loader builder, load/save helpers, and custom TypeSerializers for the dynamic sections that don't fit object mapping: Servers (entries + try), ForcedHosts, and PacketLimiterConfig (renamed keys). - Add ConfigurationLoaderTest: loads the bundled default, and round-trips a config with non-default values for every renamed/custom-mapped key so a wrong mapping can't silently fall back to an identical default. Part of the velocity.toml -> velocity.yml Configurate migration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Implement the runtime entry point for the YAML config: - ConfigurationLoader.loadConfiguration() resolves velocity.yml, migrating a legacy velocity.toml or writing the documented default on first start. Absent keys fall back to the model's field defaults (matching the old getOrElse behaviour), so existing files are never rewritten and their comments survive. - Migration runs the legacy night-config migrations to normalise the TOML, then writes it as YAML stamped config-version=1, preserving a custom forwarding-secret-file location, and archives the old file as velocity.toml.migrated. - Forwarding secret resolution mirrors the legacy path (env var, then the forwarding-secret-file, creating it if absent) and is injected via a new package-private setter; the secret stays out of velocity.yml. Not yet wired into VelocityServer; that follows in the next change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Route VelocityServer's startup and reload paths through ConfigurationLoader.loadConfiguration(), so the proxy now reads velocity.yml (migrating an existing velocity.toml on first start) instead of reading velocity.toml directly. LegacyConfigurationLoader is retained behind the migration path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the example servers, try order, and forced hosts out of the model's field defaults and into default-velocity.yml only. Previously, removing a section caused the loader to substitute the bundled examples, which reference servers the user may not have and then fail validation. With empty code defaults, a removed or emptied section now yields an empty collection and the examples are seeded solely on first-start from the documented default file. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rename the proxy configuration file and bundled default resource from velocity.yml/default-velocity.yml to velocity.yaml/default-velocity.yaml. Third-party plugin descriptor files (plugin.yml, bungee.yml, paper-plugin.yml) are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dev/4.0.0 turned ping-passthrough from an enum into a record of five booleans (version/players/description/favicon/modinfo) with a night-config migration off the legacy string form. Mark the record @ConfigSerializable so Configurate's ObjectMapper maps the section directly (all component names are already single words, so LOWER_CASE_DASHED needs no @setting overrides), and replace the string key in default-velocity.yaml with the documented section, mirroring default-velocity.toml. The TOML path needs no extra work: PingPassthroughMigration runs as part of the existing night-config migration chain before the config is dumped to YAML, so legacy values are expanded on migration. Tests: the round-trip fixture now carries the section with all five flags set, and the migration fixture starts from a legacy ping-passthrough = "DESCRIPTION" and asserts it expands to description + modinfo.
electronicboy
force-pushed
the
dev/3-configurate
branch
from
September 1, 2026 12:56
3755083 to
a5e82d0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Finishes the Configurate migration: the proxy's configuration moves from
velocity.toml(night-config) tovelocity.yaml(Configurate 4 / YAML). This is a deliberately near-1:1 "yaml-ified" port — same keys, sections and documentation — with richer configuration left as a follow-up. Existingvelocity.tomlinstalls are migrated automatically on first start.Rebased onto
dev/4.0.0(previously targeteddev/3.0.0).What it does
ConfigurationLoader.loadConfiguration()is the new entry point, wired intoVelocityServerstartup and reload. It resolvesvelocity.yaml, migrating a legacyvelocity.tomlor writing the documented default on first start.ObjectMapperover@ConfigSerializable VelocityConfiguration, withNamingSchemes.LOWER_CASE_DASHEDsocamelCasefields map tolower-case-dashedkeys.@Settingcovers the handful the scheme can't derive (kick-existing-players,packet-limiter,haproxy-protocol,accepts-transfers, queryenabled/port/map).TypeSerializers for the dynamic-shaped sections that don't fit object mapping:Servers(named entries + thetrylist in one node),ForcedHosts, andPacketLimiterConfig(renamed keys).config-version: 1, preserves a customforwarding-secret-filelocation, and archives the old file asvelocity.toml.migrated.Ping passthrough (new since the rebase)
dev/4.0.0reworkedping-passthroughfrom an enum into a record of five booleans (version,players,description,favicon,modinfo) plus aPingPassthroughMigrationoff the legacy string form. Carried across as:@ConfigSerializableand mapped directly byObjectMapper— every component name is a single word, soLOWER_CASE_DASHEDneeds no@Settingoverrides.default-velocity.yamlgains the documentedping-passthrough:section, mirroringdefault-velocity.toml.PingPassthroughMigrationruns as part of the existing night-config migration chain before the config is dumped to YAML, so legacy string values are expanded on migration.Design decisions worth a look
config-versionis now an integer (baseline1) so it can drive Configurate'sversionedBuilder()when the first YAML-schema migration is needed. That hook is documented but intentionally inert today (no YAML versions to migrate between yet). Note this is independent of the TOMLconfig-version(now"2.9"), which only gates the night-config migrations on the legacy path.default-velocity.yamlcopied verbatim on fresh install. configurate-yaml 4.2.0 has no comment-writing support, so we do not rely on@Comment. A comment-supporting Configurate fork may be adopted later. Interim: programmatically (re)written files — i.e. migrated configs — won't carry comments until then.getOrElse), so existing files are never rewritten and their comments survive. Trade-off: newly added keys aren't auto-written into existing files until they're regenerated.default-velocity.yaml, not in code. Code defaults are empty, so removing a section yields an empty collection instead of resurrecting example entries that reference servers the user doesn't have (which previously failed validation). Migration remains behavior-preserving — effective configs are unchanged when converting from TOML.Testing
ConfigurationLoaderTest: loads the bundled default; round-trips a config with non-default values for every renamed/custom-mapped key (so a wrong mapping can't silently pass, now including the fullping-passthroughsection); migrates a legacyvelocity.toml(values carried, secret-file preserved, version stamped, old file archived, and a legacyping-passthrough = "DESCRIPTION"expanded todescription+modinfo); and verifies removed sections don't resurrect defaults.dev/4.0.0.Out of scope / follow-ups
versionedBuilder()once a real YAML-schema migration exists.LegacyConfigurationLoaderonce the migration path is retired.🤖 Generated with Claude Code